package com.thoughtworks.university.biblioteca;

/**
 * Created by sravanns on 10/06/14.
 */
public class Book {
    String book_name,author;
    int year;

    Book(String name,String author,int year)
    {
        this.book_name=name;
        this.author=author;
        this.year=year;
    }
    @Override
    public String toString()
    {

       return "name: "+book_name+"\n"+"author: "+author+"\n"+"year: "+year;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Book book = (Book) o;

        if (year != book.year) return false;
        if (author != null ? !author.equals(book.author) : book.author != null) return false;
        if (book_name != null ? !book_name.equals(book.book_name) : book.book_name != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = book_name != null ? book_name.hashCode() : 0;
        result = 31 * result + (author != null ? author.hashCode() : 0);
        result = 31 * result + year;
        return result;
    }
}
